import React, { Component } from 'react';
import { hashHistory } from 'react-router'
import 'common/containers/bottom.less';

/**
 * 底部菜单组件
 */
class Bottom extends Component{

	//底部菜单事件
	menuHandle = (selectMenu, index) => {
		this.props.menuHandle(selectMenu, index)
	}

	render(){
		return(
			<div className="app_menu">
				{
					this.props.menuInfo.menus.map((menu, index) => {
						//图片显示
						let menuItem = {
							menuImg: menu.menuImg,
							menuClass: 'menu_name'
						}
						if(this.props.menuInfo.selectMenuIndex == index){
							menuItem = {
								menuImg: menu.selectedMenuImg,
								menuClass: 'menu_name_selected'
							}
						}
						return(
							<div key={index} className="subMenu" onClick={() => this.menuHandle(menu.menuUrl, index)}>
				            	<img className="menu_img" src={menuItem.menuImg}/>
				            	<div className={menuItem.menuClass}>{menu.menuName}</div>
					        </div>
						)
					})
				}
		    </div>		
		)
	}
}

export default Bottom;